﻿using Microsoft.Extensions.DependencyInjection;
using OpenAdmin.Core.DbContextLocators;

namespace OpenAdmin.EntityFramework
{
    public class OpenAdminEntityFrameworkStartup : IAppStartup
    {
        public void ConfigureServices(ConfigureServicesContext context)
        {
            context.Services.AddDatabaseAccessor(configure =>
            {
                configure.AddDbContextPool<BloggingDbContext, BloggingDbContextLocator>();
                configure.AddDbContextPool<ApplicationDbContext, ApplicationDbContextLocator>();
                configure.AddDbContextPool<MultiTenancyDbContext, MultiTenancyDbContextLocator>();

                //configure.AddDbContextPool<BloggingDbContext, BloggingDbContextLocator>(DatabaseProvider.SqlServer);
                //configure.AddDbContextPool<ApplicationDbContext, ApplicationDbContextLocator>(DatabaseProvider.SqlServer);
                //configure.AddDbContextPool<MultiTenancyDbContext, MultiTenancyDbContextLocator>(DatabaseProvider.SqlServer);
                //configure.AddDbContextPool<MallDbContext, MallDbContextLocator>(DatabaseProvider.SqlServer);
            }, "OpenAdmin.Database.Migrations");
        }

        public void Configure(ConfigureContext context)
        {

        }
    }
}
